package com.lsu.app.bean;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;

import java.io.Serializable;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;

/**
 * 图片/视频文件
 * @Date 2023-10-20 18:13:34
 * @author hjj
 */
@Data
@TableName("resource")
@ApiModel(value="Resource对象", description="图片/视频文件")
public class Resource implements Serializable {

    @ApiModelProperty("#id")
    private Integer id;

    @ApiModelProperty("1课程视频、2用户头像图片、3课程封面图片")
    private Integer type;

    @NotNull(message="[课程id/角色id]不能为空")
    @ApiModelProperty("课程id/角色id")
    private Integer uorrId;


    @ApiModelProperty("集数（传输为视频时，该值默认为1，图片默认为0）")
    private Integer episodes;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("教师昵称")
    private String teacherName;

    @NotBlank(message="[相对地址]不能为空")
    @Size(max= 64,message="编码长度不能超过64")
    @ApiModelProperty("相对地址")
    private String url;

    @ApiModelProperty("创建时间")
    private String createTime;

    @ApiModelProperty("更新时间")
    private String updateTime;

    @ApiModelProperty("备注")
    private String remake;
    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("#自身是否点赞（0未点赞，1点赞）")
    private Integer selfLike;

    public Resource(){}
    //图片
    public Resource(Integer type, Integer uorrId, String url, String createTime, String updateTime) {
        this.type = type;
        this.uorrId = uorrId;
        this.url = url;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }
    //视频
    public Resource(Integer type, Integer uorrId, String url, String createTime, String updateTime,String remake,Integer episodes){
        this.type = type;
        this.uorrId = uorrId;
        this.url = url;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.remake=remake;
        this.episodes=episodes;
    }
}
